﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Web.Controllers
{
    public class CommonController : Controller
    {
        public EdexApiClient.EdexApiContext EdexContext
        {
            get
            {
                if (Session["api_session"] == null)
                    throw new Exception("Нет доступа к данным");

                return new EdexApiClient.EdexApiContext(((EdexApiClient.API_SESSION)Session["api_session"]).APIKEY);
            }
        }
    }

    public class AsyncCommonController : AsyncController
    {
        public EdexApiClient.EdexApiContext EdexContext
        {
            get
            {
                if (Session["api_session"] == null)
                    throw new Exception("Нет доступа к данным");

                return new EdexApiClient.EdexApiContext(((EdexApiClient.API_SESSION)Session["api_session"]).APIKEY);
            }
        }
    }
}
